<?php
namespace Cyfy\Modules\SiteInformation\Forms;

use \Cyfy\Modules\Forms;
use \Cyfy\Modules\SiteInformation\Module;

/**
 * Information about site. Title, class...
 */
class Settings extends Forms\Form
{
    function structure()
    {
        $this -> permission("SiteInformation", "administration");
        $this -> stay = true;
        
        $i = new Forms\TextBox("title", self :: t(10));
        $i -> maxlength = 255;
        $i -> description = self :: t(110, array('%s'));
        $i -> required = true;
        $this -> AddItem($i);

        $i = new Forms\TextBox("name", self :: t(20));
        $i -> maxlength = 255;
        $i -> required = true;
        $i -> description = self :: t(120);
        $this -> AddItem($i);
        
        $i = new Forms\TextBox("url",self :: t(30));
        $i -> maxlength = 255;
        $i -> required = true;
        $i -> description = self :: t(130);
        $this -> AddItem($i);
        
        $i = new Forms\TextBox("email", self :: t(40));
        $i -> maxlength = 255;
        $i -> description = self :: t(140);
        $i -> required = true;
        $this -> AddItem($i);

        $i = new Forms\TextBox("author", self :: t(50));
        $i -> maxlength = 255;
        $i -> description = self :: t(150);
        $this -> AddItem($i);

        $b = new Forms\Button(self :: t(60));
        $this -> AddButton($b);
        
    }
   
    function submit()
    {
        Module :: define("title", $this -> Get("title"));
        Module :: define("name", $this -> Get("name"));
        Module :: define("url", $this -> Get("url"));
        Module :: define("email", $this -> Get("email"));
        Module :: define("author", $this -> Get("author"));
        
        \Cyfy\Message :: set(self :: t(160));
        return true;
    }
}
